"""linux"""

【淘金】项目压测参数配置模版
{
    "host": "http://170.106.161.81:8000/",
    "actions": [
        {
            "comment": "运行命令 - 删除旧日志",
            "action": "run_command",
            "param": {
                "cmd": "/bin/bash -c \"cd /mnt/data/taojin2/bot && rm -rf logs/*\""
            }
        },
        {
            "comment": "修改配置-bot数量",
            "action": "modify_file_content",
            "param": {
                "filepath": "/mnt/data/taojin2/bot/data/bot/bot_data.txt",
                "old_content_regex": "<botCount>(\\d+)</botCount>",
                "new_content": "<botCount>500</botCount>"
            },
            "checkpoint": "修改配置-bot数量"
        },
        {
            "comment": "修改配置-切换压测场景",
            "action": "modify_file_content",
            "param": {
                "filepath": "/mnt/data/taojin2/bot/data/bot/bot_data.txt",
                "old_content_regex": "(\\d+)",
                "new_content": "42"
            },
            "checkpoint": "修改配置-切换压测场景"
        }, 
        {
            "comment": "运行命令 - 启动压测脚本",
            "action": "run_command",
            "param": {
                "cmd": "bash -c \"cd /mnt/data/taojin2/bot\nbash startup.sh\n\""
            },
            "checkpoint": "启动压测脚本",
            "delay": 7800
        },  
        {
            "comment": "运行命令 - 结束压测脚本",
            "action": "run_command",
            "param": {
                "cmd": "bash -c \"cd /mnt/data/taojin2/bot\nbash shutdown.sh\n\""
            }
        },
        {
            "comment": "查看单个/多个日志文件",
            "method": "get",
            "action": "catfile",
            "param": {
                "file_path": ["/mnt/data/taojin1/logs/elapse-2025-05-24.log"]/["/mnt/data/taojin1/logs/elapse-2025-05-24.log", "/mnt/data/taojin1/logs/elapse-2025-05-21.log"],   
                "download": "false"
            }
        },
        {
            "comment": "合并日志文件并查看",
            "method": "get",
            "action": "catfiles",
            "param": {
                "file_path": [
                    "/mnt/data/taojin1/logs/elapse-2025-05-24.csv",
                    "/mnt/data/taojin1/logs/elapse-2025-05-21.csv"
                ],
                "download": "false",
                "output_path": "./file.csv"
		    }
	    },
        {
            "comment": "统计结果",
            "action": "stats_problem",
            "param": {
                "log_file_path": "/mnt/data/taojin1/bot/logs/elapse-2025-05-29.csv",
                "log_pro_cl": "Name",
                "log_total": "Total",
                "pro_success": "Success",
                "pro_tps": "TPM",
                "pro_max": "Max",
                "pro_avg": "Avg",
                "pro_90th": "Avg90",
                "csv_write": "true",
                "locustpro": "false"
            },
        "checkpoint": "统计数据"
        },
        {
            "comment": "覆盖协议及任务",
            "action": "log_protocols",
            "param": {
                "yan_filepath": "/root/autotool/【淘金2.0】服务器压测工具验收报告.xlsx",    
                "yan_pro_sheet": "协议覆盖",
                "model_cl": "所属模块",
                "proto_cl": "关联协议",
                "feature_mix": "false",
                "feature_test": "神器",    
                "csv_write": "true",
                "log_pro_cl": "Name",
                "log_filepath": "/mnt/data/taojin2/bot/logs/elapse-2025-05-29.log",     
                "log_total": "Total",
                "locustpro": "false"
            },
            "checkpoint": "覆盖协议及任务"
        },        
        {
            "comment": "权重统计",
            "action": "feature_weight",
            "param": {
                "yan_filepath": "/root/autotool/【淘金2.0】服务器压测工具验收报告.xlsx",
                "weight_sheet": "混压列表",
                "weight_model": "功能模块",
                "weight_num": "混压权重",
                "yan_pro_sheet": "协议覆盖",
                "model_cl": "所属模块",
                "proto_cl": "关联协议",
                "log_filepath": "/mnt/data/taojin1/logs/bot_202506031525.csv",
                "log_pro_cl": "Name",
                "pro_sum": "Total",
                "csv_write": "false"
            },
            "checkpoint": "权重统计"
        },
        {
            "comment": "log转csv",
            "action": "log_to_csv",
            "param": {
                "log_filepath": "elapse-2025-05-24.log"
            },
            "checkpoint": "转换日志格式"
        }
    ],
    	"zabbix": {
		"enabled": true,
		"url": "http://new-zabbix.cyou-inc.com",
		"username": "gaoweixiong",
		"password": "Yefei131413141314",
		"host": "43.130.76.194",
		"items": {
			"cpu.useful.per": true,
			"cpu.useful.core[cpu]": true,
			"vm.puserd": true,
			"vm.memory.size[used]": true
		},
		"starttime": 1744776000,
		"stoptime": 1746072000
	}
}



【轻松天龙】项目压测参数配置模版
{
    "host": "http://111.231.132.182:8000/",
    "actions": [
        {
            "comment": "运行命令 - 启动压测脚本",
            "action": "run_command",
            "param": {
                "cmd": "/bin/bash -c \"echo '---------------10.159.130.102---------------'; cd /root/tlbb_robot; ./Robot 'ProcessCount=64;InstanceCountPerProcess=15;CaseName=main_quest;ServerAddress=10.159.130.81;ServerPort=5000;ServerIndex=8169;ConvertServerIndex=8169;Account=tlgl_a_%d_%d@changyou.com;Password=123456;UseLoginPage=ChangYouSDKOB_Pre_Publish;'\""
            }
        }
    ]
}
 
------------------------------------------------------------------      


"""Locust"""
【靶心】项目压测参数配置模版
{
    "host": "http://43.153.63.118:29777/",
    "actions": [
        {
            "comment": "修改配置-切换压测场景",
            "action": "modify_file_content",
            "param": {
                "filepath": "C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\run_slave.bat",
                "old_content_regex": "l_\\w+",
                "new_content": "l_hook"
            },
            "checkpoint": "修改配置-切换压测场景"
        },
        {
            "comment": "修改配置-机器人起始id",
            "action": "modify_file_content",
            "param": {
                "filepath": "C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\account_server.py",
                "old_content_regex": "(account_start\\s*=\\s*)\\d+",
                "new_content": "\\g<1>4900000"
            },
            "checkpoint": "修改配置-机器人起始id"
        },
        {
            "comment": "运行命令 - 启动account_server.bat",
            "action": "run_command",
            "param": {
                "cmd": "C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\run_account_server.bat"
            },
            "checkpoint": "启动压测脚本",
            "delay": 5
        },
        {
            "comment": "运行命令 - 启动slave.bat",
            "action": "run_command",
            "param": {
                "cmd": "C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\run_z_single_master_slaves.bat"
            },
            "checkpoint": "启动压测脚本",
            "delay": 50
        },
        {
            "comment": "停止bat脚本",
            "action": "shutdown_bat",
            "param": {
                "bat_path": ["C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\run_slave.bat"]
            },
            "checkpoint": "停止bat脚本"
        },
        {
            "comment": "运行命令 - 启动web登录脚本",
            "action": "start_web_auto",
            "param": {
                "users": 3000,
                "hatch_rate": 5
            },
            "checkpoint": "启动web登录脚本"
        },
        {
            "comment": "运行命令 - 启动web停止脚本",
            "action": "stop_web_auto",
            "param": {
            },
            "checkpoint": "启动web停止脚本"
        }      
    ]
}

















{
    "host": "http://43.153.63.118:29777/",
    "actions": [
        {
            "comment": "修改配置-切换压测场景",
            "action": "modify_file_content",
            "param": {
                "filepath": "C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\run_slave.bat",
                "old_content_regex": "l_\\w+",
                "new_content": "l_hook"
            },
            "checkpoint": "修改配置-切换压测场景"
        },
        {
            "comment": "修改配置-机器人起始id",
            "action": "modify_file_content",
            "param": {
                "filepath": "C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\account_server.py",
                "old_content_regex": "(account_start\\s*=\\s*)\\d+",
                "new_content": "\\g<1>4900000"
            },
            "checkpoint": "修改配置-机器人起始id"
        },
        {
            "comment": "运行命令 - 启动account_server.bat",
            "action": "run_command",
            "param": {
                "cmd": "C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\run_account_server.bat"
            },
            "checkpoint": "启动account_server.bat",
            "delay": 5
        },
        {
            "comment": "运行命令 - 启动slave.bat",
            "action": "run_command",
            "param": {
                "cmd": "C:\\Users\\Administrator\\Desktop\\robot_20250509\\robot\\baxin_robot\\run_z_single_master_slaves.bat"
            },
            "checkpoint": "启动slave.bat",
            "delay": 50
        },
        {
            "comment": "运行命令 - 启动web登录脚本",
            "action": "start_web_auto",
            "param": {
                "users": 3000,
                "hatch_rate": 5
            },
            "checkpoint": "启动web登录脚本"
        }
    ]
}